<template>
  <el-dialog
    v-el-drag-dialog
    :title="!dataForm.id ? '详情' : '详情'"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="受邀人账号:">
            <span>{{dataForm.inviteeAccount}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="受邀人名称:">
            <span>{{dataForm.nameOfInvitee}}</span>
            <!-- <el-input v-model="dataForm.nameOfInvitee" placeholder="营业时间" style="width: 250px"></el-input> -->
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="推荐人账号:">
            <span>{{dataForm.recommenderAccount}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="推荐人名称:">
            <span>{{dataForm.nameOfRecommender}}</span>
            <!-- <el-input v-model="dataForm.msn" placeholder="营业时间" style="width: 250px"></el-input> -->
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="受邀类型:">
            <span>{{dataForm.beInvitedType === 1 ? '运营商' : (dataForm.beInvitedType === 2 ? '普通联盟店' : (dataForm.beInvitedType === 3 ? '消费者' : (dataForm.beInvitedType === 4 ? 'VIP会员' : (dataForm.beInvitedType === 5 ? '中级联盟店' : (
              dataForm.beInvitedType === 6 ? '高级联盟店' : (dataForm.beInvitedType === 7 ? '城市合伙人' : (dataForm.beInvitedType === 8 ? '城市合伙人联盟店' : '')))))))}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="推荐人类型:">
            <span>{{dataForm.recommenderType === 1 ? '运营商' : (dataForm.recommenderType === 2 ? '普通联盟店' : (dataForm.recommenderType === 3 ? '消费者' : (dataForm.recommenderType === 4 ? 'VIP会员' : (dataForm.recommenderType === 5 ? '中级联盟店' : (
              dataForm.recommenderType === 6 ? '高级联盟店' : (dataForm.recommenderType === 7 ? '城市合伙人' : (dataForm.recommenderType === 8 ? '城市合伙人联盟店' : '')))))))}}</span>
            <!-- <el-input v-model="dataForm.recommenderType" placeholder="营业时间" style="width: 250px"></el-input> -->
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="受邀人奖励券:">
            <span>{{dataForm.beInvitedIntegral}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="推荐人奖励券:">
            <span>{{dataForm.recommenderIntegral}}</span>
            <!-- <el-input v-model="dataForm.msn" placeholder="营业时间" style="width: 250px"></el-input> -->
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="受邀人是否登录:">
            <span>{{dataForm.beInvitedIsLogin}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="邀请时间:">
            <span>{{dataForm.invitationTime}}</span>
            <!-- <el-input v-model="dataForm.msn" placeholder="营业时间" style="width: 250px"></el-input> -->
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="登录时间:">
            <span>{{dataForm.loginDate}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="受邀人手机号:">
            <span>{{dataForm.beInvitedMobile}}</span>
            <!-- <el-input v-model="dataForm.beInvitedMobile" placeholder="营业时间" style="width: 250px"></el-input> -->
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        dialogImageUrl: '',
        dialogVisible: false,
        dataForm: {
          recommendId: '',
          inviteeAccount: '',
          nameOfInvitee: '',
          recommenderAccount: '',
          nameOfRecommender: '',
          beInvitedType: '',
          recommenderType: '',
          beInvitedIntegral: '',
          recommenderIntegral: '',
          beInvitedIsLogin: '',
          invitationTime: '',
          loginDate: '',
          beInvitedMobile: ''
        },
        dataRule: {}
      }
    },
    methods: {
      init (id) {
        this.dataForm.recommendId = id || 0
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.recommendId) {
            this.$http({
              url: this.$http.adornUrl(`/member/consumer/getInviteMembersDetailsById/${this.dataForm.recommendId}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.dataForm.inviteeAccount = data.data.inviteeAccount
                this.dataForm.nameOfInvitee = data.data.nameOfInvitee
                this.dataForm.recommenderAccount = data.data.recommenderAccount
                this.dataForm.nameOfRecommender = data.data.nameOfRecommender
                this.dataForm.beInvitedType = data.data.beInvitedType
                this.dataForm.recommenderType = data.data.recommenderType
                this.dataForm.beInvitedIntegral = data.data.beInvitedIntegral
                this.dataForm.recommenderIntegral = data.data.recommenderIntegral
                this.dataForm.beInvitedIsLogin = data.data.beInvitedIsLogin
                this.dataForm.invitationTime = data.data.invitationTime
                this.dataForm.loginDate = data.data.loginDate
                this.dataForm.beInvitedMobile = data.data.beInvitedMobile
              }
            })
          }
        })
      }
    }
  }
</script>
